{extend name="index_layout"/}
{block name="main"}
<div class="layui-card wordsEdit">
    <div class="layui-card-header">指派帮助人</div>
    <div class="layui-card-body">
        <form class="layui-form form-horizontal" action="{:url('admin/applyhelp/helpMember')}" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">用户</label>
                <input type="hidden" name="id" value="{$id}">
                <div class="layui-input-inline">
                    <select name="user_id" id="user" class="layui-form-select" lay-search="">
                        <option value='' disabled selected style='display:none;'>输入用户手机号选择用户</option>
                        {volist name="$data" id="vo"}
                        <option value="{$vo.id}">{$vo.username}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="layui-form-item" style="margin-left: 20%;margin-top: 30px;">
                <div class="layui-input-block">
                    <button class="layui-btn ajax-post" lay-submit="" lay-filter="*" target-form="form-horizontal">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script" }
<script type="text/javascript" src="__STATIC__/admin/js/common.js"></script>
<script>
    function renderForm(){
        layui.use('form', function(){
            var $ = layui.$;
            var form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
            form.render('select');
        });
    }
        function searchMember() {
            var address = $("#address").val();
            var id = $("#id").val();
            $.ajax({

                url: "chooseUser",
                type: "post",
                data: {"address": address, "id": id},
                success: function (data) {

                    var list = data.data;
                    var html = '<option value="0">输入用户手机号选择用户</option>';

                    if (list.length > 0) {
                        for (var i = 0; i <= list.length; i++) {
                            html += '<option value=' + list[i]['id'] + '>' + list[i]['username'] + '</option>';
                        }
                    }
                    $("#user").html(html);
                    renderForm();

                }

            })

        }

</script>
{/block}